import React from 'react';
import {routerRedux} from 'dva/router';
import {LocaleProvider} from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import config from '@/config/route.config';
import RouteView from '@/components/RouteView';
import moment from 'moment';
import 'moment/locale/zh-cn';
const {ConnectedRouter} = routerRedux;

moment.locale('zh-cn');

export default ({history, app}) => {
    const routesConfig = config(app);
    // 将实例化好的路由配置注入到 React 对象上进行全局使用
    React._routesConfig = routesConfig;
    return (
        <LocaleProvider locale={zh_CN}>
            <ConnectedRouter history={history}>
                <RouteView routesKey="/" />
            </ConnectedRouter>
        </LocaleProvider>
    );
};
